package com.redstar.interesting.common.starter.intercepter;

import lombok.extern.slf4j.Slf4j;
import org.springframework.core.Ordered;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 当请求走到这里时说明已经进入web容器之中了，可以在这里做登录校验或者权限校验等操作
 * @author lihongxing
 */
@Slf4j
@Component
public class CustomerWebInterceptor implements HandlerInterceptor , Ordered {

    /**
     * 最高优先级
     * @return
     */
    @Override
    public int getOrder() {
        return Ordered.HIGHEST_PRECEDENCE;
    }

    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        log.info("CustomerWebInterceptor ==== 执行啦");
        return true;
    }


}
